#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <wiringPi.h>
#include <wiringPiI2C.h>

int main(int argc,char *argv[])
{
int ret = 0;
int dev = 0x20;

if(argc > 1)
{
dev =atoi(argv[1]);
}

wiringPiSetup();

int fd = wiringPiI2CSetup(dev);
printf("setup dev %02x fd = %d\n",dev,fd);

if(fd > 0)
{
ret = wiringPiI2CWriteReg8(fd,0x06,0);
printf("write reg 0x06 to output ret = %d\n",ret);	

ret = wiringPiI2CWriteReg8(fd,0x07,0);
printf("write reg 0x07 to output ret = %d\n",ret);	

ret = wiringPiI2CWriteReg8(fd,0x02,0);
printf("write reg 0x02 to low ret = %d\n",ret);	
ret = wiringPiI2CWriteReg8(fd,0x03,0);
printf("write reg 0x03 to low ret = %d\n",ret);	

close(fd);
}

return  ret;
}

